import React,{useState} from "react";
import { Input } from "antd";

const TodoInput = ({placeholder,onSetQuery}) => {
    const [value,setValue] = useState("");
    const onAdd = ()=> {
        //向父组件报告
        onSetQuery(value);
    }
    return (
        <section className="input-wrap">
            <Input
                className="input input-wrap"
                onPressEnter={onAdd}
                value={value}
                placeholder={placeholder}
                onChange={e => setValue(e.target.value)}
            />
        </section>
    )
}

export default TodoInput;